package com.atguigu.gulimall.order.config;

/**
 * @program: gulimall
 * @description: TODO
 * @author: YuWenYi
 * @create: 2021-07-20 21:20
 **/
//@Configuration
public class MySeataConfig {

//	@Bean
//	@ConfigurationProperties(prefix = "spring.datasource.druid")
//	public DruidDataSource druidDataSource() {
//		return new DruidDataSource();
//	}
//
//	@Primary
//	@Bean
//	public DataSourceProxy dataSource(DruidDataSource druidDataSource) {
//		return new DataSourceProxy(druidDataSource);
//	}

	/**
	 *  mybatis-plus 配置 -----------------------
	 *  需要 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
	 */
//	// 利用代理数据源来创建SqlSessionFactory对象
//	@Bean
//	public SqlSessionFactory sessionFactory(DataSourceProxy dataSource) throws Exception {
//		SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
//		factoryBean.setDataSource(dataSource);
//
//		MybatisConfiguration configuration = new MybatisConfiguration();
//		configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
//
//		factoryBean.setConfiguration(configuration);
//		factoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
//
//		return factoryBean.getObject();
//	}

}